home *** CD-ROM | disk | FTP | other *** search
/ Cream of the Crop 1 / Cream of the Crop 1.iso / PROGRAM / DJLSR106.ARJ / GETKEY.S < prev    next >
Text File  |  1992-03-29  |  1KB  |  62 lines

  1. /* This is file GETKEY.S */
  2. /*
  3. ** Copyright (C) 1991 DJ Delorie, 24 Kirsten Ave, Rochester NH 03867-2954
  4. **
  5. ** This file is distributed under the terms listed in the document
  6. ** "copying.dj", available from DJ Delorie at the address above.
  7. ** A copy of "copying.dj" should accompany this file; if not, a copy
  8. ** should be available from where this file was obtained.  This file
  9. ** may not be distributed without a verbatim copy of "copying.dj".
  10. **
  11. ** This file is distributed WITHOUT ANY WARRANTY; without even the implied
  12. ** warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
  13.  
  14. Modified by J. Alan Eldridge, Liberty Brokerage, 77 Water St, NYC 10005
  15.  
  16. Changed handling of characters starting with 0xE0:
  17.     Now calls interrupt 16, function 10
  18.     if leading byte was 0x00, ah = 0x01
  19.     if leading byte was 0xE0, ah = 0x02
  20.  
  21.     The main function is now called getxkey()...
  22.     getkey is provided to maintain compatibility with
  23.     already written software
  24. */
  25.  
  26.     .globl    _getxkey
  27. _getxkey:
  28.     pushl    %ebx
  29.     pushl    %esi
  30.     pushl    %edi
  31.     movb    $0x10,%ah
  32.     int    $0x16
  33.     mov    $1,%bl
  34.     cmpb    $0,%al
  35.     je    L0
  36.     cmpb    $0xE0,%al
  37.     jne    L1
  38.     inc    %bl
  39. L0:
  40.     movb    %ah,%al
  41.     movb    %bl,%ah
  42.     jmp    L2
  43. L1:
  44.     movb    $0,%ah
  45. L2:
  46.     andl    $0xffff,%eax
  47.     popl    %edi
  48.     popl    %esi
  49.     popl    %ebx
  50.     ret
  51.  
  52.     .globl    _getch
  53.     .globl    _getkey
  54. _getch:
  55. _getkey:
  56.     call    _getxkey
  57.     testb    $0x02,%ah
  58.     jz    L3
  59.     movb    $0x01,%ah
  60. L3:
  61.     ret
  62.